var familyMonth = ring.create({
    calculateMonthPath: null,
    monthId: null,
    
    constructor: function(calculateMonthPath)
    {
        this.calculateMonthPath = calculateMonthPath;
    },
   
    attachListeners: function()
    {
        var that = this;
        $('#calculateMonthButton').click(function(){
            that.calculateMonth();
        });
    },
    
    setMonthId: function(monthId)
    {
        this.monthId = monthId;
    },
    
    calculateMonth: function()
    {
        if (this.monthId === null) {
            alert("Nie można wykonać rozliczenia dla wybranego miesiąca!\n ");
            return false;
        }
        
        $.ajax({
            url: this.calculateMonthPath,
            method: 'POST',
            data: {monthId: this.monthId},
            success: function(data)
            {
                alert(data.msg);
                //console.log(data);
            }
        });
    },
    
    showPeriod: function(periodInfo)
    {
        $('#month-info').html(periodInfo);
    }
   
});
